<?php

namespace App\Models;

use App\User;

class Admin extends User {

    public $table = 'users';
 
     public function scopeOfAll($query)
    {
        $query->select('users.id', 'users.name', 'roles.display_name as role_name', 'users.updated_at', 'users.email')
              ->leftJoin('role_user', 'users.id', '=', 'user_id')
              ->leftJoin('roles', 'roles.id', '=', 'role_user.role_id')
              ->whereIn('roles.name', config('setting.adminGroups'));

        return $query;
    }
}
